﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoreEx.Samples.ServiceFacade;
using CoreEx.Wcf.Server;
using CoreEx.Wcf.Server.Tests;
using LinFu.IoC;
using System.ServiceModel;

namespace CoreEx.Wcf.Server.Tests
{
    public class ServiceBaseFixture : BaseFixture
    {
        protected ServiceHost _serviceHost;
        
        public override void SetUp()
        {            
            base.SetUp();
            Uri uri = _serviceContainer.GetService<Uri>(typeof(ICustomerService));            
            _serviceHost = _serviceContainer.GetService<ServiceHost>(new object[]{typeof(ICustomerService), new Uri[]{uri}});
            _serviceHost.Open();
        }

        public override void TearDown()
        {
            _serviceHost.Close();
            base.TearDown();
        }
    }
}